//
//  ErrorLogDataObject.m
//  
//
//  Created by 冷悦 on 16/3/7.
//
//

#import "ErrorLogDataObject.h"
#import "CoreDataUtil.h"

@implementation ErrorLogDataObject

// Insert code here to add functionality to your managed object subclass
-(instancetype)initWithUserId:(NSInteger)userId
                         code:(NSInteger)code
                      message:(NSString *)message
                          api:(NSString *)api
                 andTimestamp:(long long)timestamp{
    NSManagedObjectContext *managedObjectContext = [CoreDataUtil sharedInstance].managedObjectContext;
    NSEntityDescription *description = [NSEntityDescription entityForName:@"ErrorLogDataObject"
                                                   inManagedObjectContext:managedObjectContext];
    self = [super initWithEntity:description insertIntoManagedObjectContext:managedObjectContext];
    
    if(self != nil){
        self.userId = [NSNumber numberWithInteger:userId];
        self.code = [NSNumber numberWithInteger:code];
        self.message = message;
        self.api = api;
        self.timestamp = [NSNumber numberWithLongLong:timestamp];
    }
    
    return self;
}

@end
